<?php
namespace app\admin\controller;
use app\admin\model\Admin as AdminModel;
use think\Controller;


class Login extends Controller
{
    public function index(){
        return view();
    }

    public function login(){
    	$login = new AdminModel();
        if(!captcha_check($_POST['captcha'])){
            //验证失败
            $this->error('验证码错误');
        }else{
            $res = $login->login($_POST);
        }
    	if($res == 1){
    		$this->error('不存在该管理员');
    	}
    	if($res == 2){
    		$this->error('密码错误');
    	}
    	if($res == 3){
    		$this->success('登录成功',url('Index/index'));
    	}
    }
}
